version 16.1
set seed 2000
set processor 1
set sortseed 2000
set rngstate XAA0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001391839


set rng mt64s
set seed 2000
set rngstream 2000



set more off


* set the path to global

global path_data "CHANGE TO YOUR PATH"




global pardir "$path_data/outputs"


global path_do "$path_data/do_files"

adopath + "$path_data/ado"



log using "$pardir/log_all", replace



**************************************************


*** run the code for cleaning.


do "$path_do/1_cleaning.do"


*** run the codes for outputs.


do "$path_do/2_table_1.do"

do "$path_do/2_table_2.do"

do "$path_do/2_table_3.do"

do "$path_do/2_table_4.do"

do "$path_do/2_table_5.do"

do "$path_do/2_table_6.do"



do "$path_do/3_table_D1.do"
do "$path_do/3_table_D2.do"
do "$path_do/3_table_D3.do"
do "$path_do/3_table_D4.do"
do "$path_do/3_table_D5.do"
do "$path_do/3_table_D6.do"

do "$path_do/3_table_J1.do"
do "$path_do/3_table_J2.do"
do "$path_do/3_table_J3.do"
do "$path_do/3_table_J4.do"


do "$path_do/4_figure_B.do"
do "$path_do/4_figure_F1.do"
do "$path_do/4_figure_G1.do"
do "$path_do/4_figure_G2.do"

do "$path_do/4_figure_H1.do"
do "$path_do/4_figure_H2.do"
do "$path_do/4_figure_I.do"



* remove intermediate data set in temporally folders
capture rm "$path_data/temp/hh_a1_a12_merge.dta"
capture rm "$path_data/data/temp/attrition_check.dta"
capture rm "$path_data/data/temp/main_reg_data_for_merging.dta"
capture rm "$path_data/data/temp/main_reg_data_psc_hetero_age.dta"
capture rm "$path_data/data/temp/main_reg_data_psc_hetero.dta"
capture rm "$path_data/data/temp/main_reg_data_psc_sumstat.dta"
capture rm "$path_data/data/temp/main_reg_data_psc.dta"
capture rm "$path_data/data/temp/main_reg_data.dta"
capture rm "$path_data/data/temp/psm_attrition.dta"
capture rm "$path_data/data/temp/results_grade3.dta"
capture rm "$path_data/data/temp/results_grade4.dta"


log close




